package com.mao.model.organization;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.struts2.json.annotations.JSON;

import com.mao.model.BaseModel;

@Entity
@Table(name = "MAO_ORGANIZATION")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Organization extends BaseModel{
	private static final long serialVersionUID = 1L;

	private Long id;
	
	private String name;
	
	private String bankNo; // 银行卡
	
	private String contactPerson; // 联系人
	
	private String phone; // 联系电话
	
	private String fax; // 传真
	
	private String email; // 邮箱
	
	private String zipCode; // 邮编
	
	private String address; // 地址
	
	private String note; // 备注
	
	private OrganizationClass oc;
	
	@Id
	@GeneratedValue
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name = "BANKNO")
	public String getBankNo() {
		return bankNo;
	}

	public void setBankNo(String bankNo) {
		this.bankNo = bankNo;
	}

	@Column(name = "CONTACTPERSON")
	public String getContactPerson() {
		return contactPerson;
	}

	public void setContactPerson(String contactPerson) {
		this.contactPerson = contactPerson;
	}

	@Column(name = "PHONE")
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "FAX")
	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	@Column(name = "EMAIL")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "ZIPCODE")
	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	@Column(name = "ADDRESS")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "NOTE", columnDefinition = "TEXT")
	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}
	
	@ManyToOne(optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "ORGANIZATIONCLASS", nullable = false, columnDefinition = "int")
	@JSON(serialize = false)
	public OrganizationClass getOc() {
		return oc;
	}

	public void setOc(OrganizationClass oc) {
		this.oc = oc;
	}
	
	
}
